package com.NeuglsWorkStudio.UI.FormElement.Component
{
	import com.NeuglsWorkStudio.UI.Buttons.TRadioButton;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TConfig;
	import com.NeuglsWorkStudio.UI.FormElement.Config.TRadioBoxConfig;
	
	public class TRadioBox extends TComponent
	{
		private var _FRadioButton:TRadioButton;
		private var _FChecked:Boolean=false;

		public function get OnClick():Function
		{
			return _FOnClick;
		}

		public function set OnClick(value:Function):void
		{
			_FOnClick = value;
			_FRadioButton.OnClick=value;
		}

		public function get Checked():Boolean
		{
			return _FChecked;
		}

		public function set Checked(value:Boolean):void
		{
			_FChecked = value;
			_FRadioButton.Checked=value;
		}

		private var _FOnClick:Function=null;
		
		public function TRadioBox(AConfig:TConfig)
		{
			super(AConfig);
		}
		
		
		private function RadioBoxConfig():TRadioBoxConfig{
			return _FConfig as TRadioBoxConfig;
		}
		
		override protected function Init():void{
			super.Init();
			_FRadioButton=new TRadioButton(RadioBoxConfig().Caption,false,RadioBoxConfig().BaceColor);
			Checked=RadioBoxConfig().Checked;
			OnClick=RadioBoxConfig().OnClick;
			
			this.addChild(_FRadioButton);
		}
	}
}